package ActivityPractice;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by 蜡笔小新丶 on 2017/9/24.
 */
public class OutValue {
    ArrayList<Integer> list;
    public OutValue(){
        list = new ArrayList<Integer>();
    }

    public void add(int num){
        for(int i=0;i<num;i++){
            int A = 2*i + 1;
            list.add(A);
        }
    }

    public String Out(){
        String result;
        int i = 0, min = 0, max = 0;
        for(int j=i+1;j<list.size();j++){
            if(list.get(i)>list.get(j))
                min = j;
            else if(list.get(i)<list.get(j))
                max =j;
        }
        result = "最大值：" + list.get(max) + "； 最小值：" + list.get(min);
        return result;
    }
}
